package com.roger.springcloudGreenwich;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
//        String flow = "tom(2022-2)-->roger(2022-2-9)-->PaaS产品总监指定PM-->项目经理-->PMO-->财务经理-->PaaS产品总监审批";
//        String current = "jack(2022-2-9)";
//        System.out.println(generateFlow(flow , current));
        //jiaoji();
//        List<String> list = new ArrayList<>();
//        System.out.println(list);
//        list.add("1");
//        list.add("2");
//        System.out.println(list);
//        System.out.println("==================");
//        list.clear();
//        System.out.println(list);

        System.out.println(String.valueOf(true));
    }

    public static String generateFlow(String flow , String current) {

        String[] array = flow.split("-->");

        for(int i = 0; i < array.length; i++){
            String node = array[i];
            if(!node.contains("(20")){
                //说明这个节点没有被执行,要被替换
                array[i] = current;
                break;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(String node : array){
            sb.append(node).append("-->");
        }
        int last = sb.lastIndexOf("-->");
        return sb.substring(0, last);
    }

    private static void jiaoji(){
        List<Integer> list1 = new ArrayList<>();
        list1.add(1);
        list1.add(2);
        list1.add(3);

        List<Integer> list3 = new ArrayList<>(list1);

        List<Integer> list2 = new ArrayList<>();
        list2.add(3);
        list2.add(4);
        list2.add(2);

        List<Integer> list4 = new ArrayList<>(list2);

        System.out.println(list1);
        System.out.println(list2);
        System.out.println(isjiaoji(list3 , list4));
        System.out.println(list1);
        System.out.println(list2);

        System.out.println("=================");
        System.out.println(list3);
    }

    private static boolean isjiaoji(List<Integer> list1, List<Integer> list2){
        list1.retainAll(list2);
        if(list1.isEmpty()){
            return false;
        }
        return true;
    }

}
